import request from '@/utils/request'

export function getDemoTestList (params) {
  return request({
    url: '/api/demo_test/list',
    method: 'get',
    params
    // redirect: '404'
  })
}

export function createDemoTest (data) {
  return request({
    url: '/api/demo_test',
    method: 'post',
    data
  })
}

export function updateDemoTest (data) {
  return request({
    url: `/api/demo_test/${data.demoId}`,
    method: 'put',
    data
  })
}

export function deleteDemoTest (demoId) {
  return request({
    url: `/api/demo_test/${demoId}`,
    method: 'delete'
  })
}

export function uploadPic (data) {
  return request({
    url: `/api/upload-image`,
    method: 'post',
    data,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}
export function getPicture (filename) {
  return request({
    url: `/upload/${filename}`,
    method: 'GET'
  })
}
export function getCutHistory () {
  return request({
    url: `/api/getCutHistory`,
    method: 'GET'
  })
}
export function deleteCutHistory(filename: string) {
  return request({
    url: '/api/deleteCutHistory',
    method: 'delete',
    data: { filename }
  });
}
